package gov.mogaha.ntis.cmm.mob.law.view;


import gov.mogaha.ntis.cmm.mob.R;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

public class CmmMobLawTitleView extends LinearLayout {

	View view;
	TextView titleTextView;
	
	Button 	rBtn;
	Button	lBtn;
	
	public CmmMobLawTitleView(Context context) {
		super(context);	

		init();
	}

	public CmmMobLawTitleView(Context context, AttributeSet attrs) {
		super(context, attrs);	
		
		init();
	}
	
	public void init() {
		LayoutInflater li = (LayoutInflater) getContext().getSystemService(
				Context.LAYOUT_INFLATER_SERVICE);
		view = li.inflate(R.layout.cmmmoblawtitleview, this, false);
		addView(view);

		
		titleTextView = (TextView)findViewById(R.id.title_text);
		lBtn = (Button)findViewById(R.id.l_btn);
		rBtn = (Button)findViewById(R.id.r_btn);
		
		lBtn.setVisibility(View.GONE);
		rBtn.setVisibility(View.GONE);
		
		/*
		rBtn.setOnClickListener(new View.OnClickListener() {
			public void onClick(View arg0) {
				
				AlertDialog.Builder alert = new AlertDialog.Builder(getContext());
				alert.setMessage("메인메뉴가 나올 예정입니다");
				alert.setPositiveButton(R.string.messagebox_ok, new DialogInterface.OnClickListener() {
				    public void onClick( DialogInterface dialog, int which) {
				        dialog.dismiss(); 
				    }
				});
				alert.show();
				
			}
		});
		*/
	}
	
	public void setTitle(String title) {
		titleTextView.setText(title);
	}
	
	public void setTitle(String title, int size) {
		titleTextView.setText(title);
		titleTextView.setTextSize(size);
	}
	
	public Button openLeftBtn() {
		lBtn.setVisibility(View.VISIBLE);
		return lBtn;
	}
	
	public Button openRightBtn() {
		rBtn.setVisibility(View.VISIBLE);
		return rBtn;
	}
}